#!/usr/bin/python3

import time
from datetime import date
from datetime import datetime
from math import sqrt
from random import choice, randrange, random, uniform
import cv2
import keyword
import sys
from sys import argv, path
from collections import deque



#
# # 集合，java中的set，无序
# basket = {1, " dfd", "1", "abc", "abc", "abc_", 2, 1, "你好"}
# print(basket)
# # 空集合只能用这个创建
# s = set()
# s.add(1)
# s.add(1)
# print(s)
#
# ss = set("abc12")
# print(ss)
#
# abb = set("12bhj你哈得")
# print(abb)
#
# a = set('abracadabra')
# b = set('alacazam')
# print(a, b)
# print(a - b)
# print(a | b)
# print(a & b)
# print(a ^ b)
#
# bala = {x for x in 'abracadabra' if x not in 'abc'}
# print(bala)
# print(type(bala))
#
# xmx = {"a": 1, "b": 2, "c": 3}
# print(type(xmx))
# xmx["芭比"] = set()
# print(xmx)
# print(xmx["b"])
# del xmx["c"]
# print(xmx)
# print("a" in xmx)
# print("1" in xmx)
# print(list(xmx.keys()))
# for k, v in xmx.items():
#     print(k, v)


#
# vec = [1, 2, 4, 7]
# vec_ = [x * 2 for x in vec]
# print(vec_)
# x_ = [x for x in vec if x % 2 == 0]
# print(x_)
# vec2 = [[x, x**2] for x in vec]
# print(vec2)
#
# freshfruit = ['  banana', '  loganberry ', 'passion fruit  ']
# ff2 = [x.upper().strip() for x in freshfruit if "e" in x]
# print(ff2)
#
# # 遍历乘法
# list1 = [-11, 3, -1]
# list2 = [2, -3, 44, 55]
# list3 = [x * y for x in list1 for y in list2]
# print(list3)
#
# range_ = [str(round(355 / 113, i)) for i in range(1, 6)]
# print(range_)

# queue = deque()
#
#
# queue.append("1")
# queue.append("2")
# queue.append(3)
# queue.append("妮妮")
#
# print(queue)
# print(len(queue))
#
# print(queue.pop())
# print(queue)
# print(queue.popleft())
# print(queue)

#
# a = [123, -0.3, 3333, 333]
# # 这种排序只能对同一类型
# a.sort()
# print(a)
# a.reverse()
# print(a)
#
# b = ["1", "ddf", "带风带", "v", "你好"]
# b.sort()
# print(b)
# b.reverse()
# print(b)
#
# count = b.count("1")
# print(count)
#
# b.insert(0, "ddd")
# print(b)
#
# print(b.index("1"))
# b.append("baba")
# print(b)
# print(b.pop())
# print(b)
# print(b[-1])

#
# # 不带参数的装饰器
# def decorator2(func):
#     def wrapper(*args, **kwargs):
#         # 这里是在调用原始函数前添加的新功能
#         print("balabal")
#
#         print(type(*args))
#
#         result = func(*args, **kwargs)
#
#         # 这里是在调用原始函数后添加的新功能
#         print("11111")
#         print(type(result))
#
#         return result
#
#     return wrapper
#
#
# # 带参数的装饰器
# def repeat(num):
#     def decorator(func):
#         def wrapper(*args, **kwargs):
#             for _ in range(num):
#                 result = func(*args, **kwargs)
#             return result
#
#         return wrapper
#
#     return decorator
#
#
# # @repeat(3)
# @decorator2
# @repeat(3)
# def greet(name):
#     print(f"hello, {name}")
#
#
# greet("xiaohong")

# numbers = [1, 2, 3, 4, 5]
# squared = list(map(lambda x: x**2, numbers))
# print(squared)  # 输出: [1, 4, 9, 16, 25]
# map()是一个函数，对于列表的每个元素应用一个函数，并返回一个包含所有函数返回值的新列表。
numbers = [1, 2, 3, 4, 5]
squared = list(map(lambda x: x**2, numbers))
print(squared)  # 输出: [1, 4, 9, 16, 25]

l = [1,2]
m = map(lambda X: X * 2, l)
print(list(m))

# x = lambda a, b, c : a+b +c
# print(x(1, 2, 3))
# f = lambda : "hello"
# print(f())

# print(date.today())
# print(str(datetime.now()))
# print(datetime.now().strftime('%Y%m%d_%H%M%S'))

# set2 = {"ad", 'b', 'c'}
# print(type(set2))
# s = set(["1", 2, 3.3, 2])
# print(s, type(s))
# print(2 in s)
# a = set('abracadabra')
# b = set('alacazam')
# print(a)
# print(a -b)
# print(a | b)
# print(a & b)
# print(a ^ b)
#
# print("------")
# print(set2)
# set2.add("d")
# print(set2)
# set2.update(a)
# print(set2)
# set2.remove("b")
# print(set2)
# # set2.remove("b")
# discard = set2.discard("b")
# print(discard)
# print(set2.pop())
# set2.clear()
# set2.clear()
# print(set2)

# dict2 = {
#     "name": "zhangsan",
#     "age": 18
# }
# print(dict2)
# print(str(dict2))
# dic3 = dict2.copy()
# print(id(dict2), id(dic3))
# print(dict2.items())
# items = dict2.items()
# for i in items:
#     print(i)
# print(dict2.keys())
# print(dict2.values())
# print(dict2.popitem())
# print(dict2)

#
# dict2 = {
#     "name": "zhangsan",
#     "age": 18
# }
#
# print(dict2["name"])
# print(type(dict2))
# dict3 = {}
# print(type(dict3))
# print(len(dict2))
# # print(dict2["1"])
#
# dict2["name"] = "lisi"
# print(dict2)
# dict2["address"] = "babalala"
# print(dict2)
#
# del dict2["address"]
# print(dict2)
# # del dict2["address"]
# del dict2
# print(dict2)
# # del dict2


#
# tup = (1, 2, 3)
# print(type(tup))
# print(tup[1])
#
# # tup[0] = 22
# print(id(tup))
# tup = (1, 2)
# print(id(tup))


# from numpy._core.defchararray import capitalize
#
# print(capitalize("a电风扇电风扇"))
# name = "nihao"
# print(name.center(23, "*"))
# print(name.count("n", 0,3))
#
# encode = name.encode("utf-8")
# print(encode)
# print(encode.decode("GBK"))
# print(name.encode("GBK"))

# name = 'Runoob'
# print(f'Hello {name}')  # 替换变量
# print(f'{1 + 2}')  # 使用表达式
#
# w = {'name': 'Runoob', 'url': 'www.runoob.com'}
# print(f'{w["name"]}: {w["url"]}')
#
# print("\a")
# print("hello \t world")
#
# # !/usr/bin/python3
#
# print("我叫 %s 今年 %d 岁!" % ('小明', 10))

# f = sqrt(2)
# print(f)
#
# print(round(1.54565, 3))
#
# print(choice([1, 2, 3, 4, 5]))
# print(randrange(1, 10))
# print(random())
# print(uniform(1, 10))


# n = 10
# if n > 5:
#     print(n)
#
# if (n := 10) > 5:
#     print(n)
#
# # id() 函数用于获取对象内存地址。
# i = id(n)
# print(i)

#
# num_int = 123
# num_flo = 1.23
#
# num_new = num_int + num_flo
#
# print("num_int 数据类型为:", type(num_int))
# print("num_flo 数据类型为:", type(num_flo))
#
# print("num_new 值为:", num_new)
# print("num_new 数据类型为:", type(num_new))
#
# int = 123
# str2 = "dfdsf"
#
# print("int :", int, " type : ", type(int))
# print("str :", str2, " type : ", type(str2))
# # print("int + str", int + str)
# print("int + str", str(int) + str2)

# bd = bytes("Ahello", "utf-8")
# print(bd)
# print(bd[0])
# print(hex(9))
# print(oct(8))
# print(ord("你"))

# # dictionary 类似于java中的map
# dic = {"key1": "hahah", "key2": "nijie"}
# dic["key3"] = "balabal"
#
# print(dic)
# print(dic["key1"])
# print(dic["key2"])
# print(dic.keys())
# print(dic.values())
#
# create1 = dict([("a", "ban"), ("b", "double")])
# create2 = {x: x ** 2 for x in range(1, 11)}
# print(create1)
# print(create2)
# # dict = dict(aa=dfdfdsv, dfsdf = fdfdsf)

# # !/usr/bin/python3
#
# #set集合无序、唯一
# sites = {'Google', 'Taobao', 'Runoob', 'Facebook3', 'Zhihu', 'Baidu', "Zhihu"}
# sites2 = {'Google', 'Taobao2', 'Runoob', 'Facebook', 'Zhihu', 'Baidu', "Zhihu"}
# print(sites ^ sites2)
#
# print(sites)  # 输出集合，重复的元素被自动去掉
#
# # 成员测试
# if 'Runoob' in sites:
#     print('Runoob 在集合中')
# else:
#     print('Runoob 不在集合中')
#
# # set可以进行集合运算
# # 这种方法生成的set直接分割单个字符了
# a = set('abracadabra')
# b = set('alacazam')
#
# print(a)
#
# print(a - b)  # a 和 b 的差集
#
# print(a | b)  # a 和 b 的并集
#
# print(a & b)  # a 和 b 的交集
#
# print(a ^ b)  # a 和 b 中不同时存在的元素

# !/usr/bin/python3

# tuple = ('abcd', 786, 2.23, 'runoob', 70.2)
# tinytuple = (123, 'runoob')
#
# print(tuple)  # 输出完整元组
# print(tuple[0])  # 输出元组的第一个元素
# print(tuple[1:3])  # 输出从第二个元素开始到第三个元素
# print(tuple[2:])  # 输出从第三个元素开始的所有元素
# print(tinytuple * 2)  # 输出两次元组
# print(tuple + tinytuple)  # 连接元组

# def reverseWords(input):
#     # 通过空格将字符串分隔符，把各个单词分隔为列表
#     inputWords = input.split(" ")
#
#     # 翻转字符串
#     # 假设列表 list = [1,2,3,4],
#     # list[0]=1, list[1]=2 ，而 -1 表示最后一个元素 list[-1]=4 ( 与 list[3]=4 一样)
#     # inputWords[-1::-1] 有三个参数
#     # 第一个参数 -1 表示最后一个元素
#     # 第二个参数为空，表示移动到列表末尾
#     # 第三个参数为步长，-1 表示逆向
#     inputWords = inputWords[-1::-1]
#
#     # 重新组合字符串
#     output = ' '.join(inputWords)
#
#     return output
#
#
# if __name__ == "__main__":
#     input = 'I like runoob'
#     rw = reverseWords(input)
#     print(rw)

# !/usr/bin/python3

# list = ['abcd', 786, 2.23, 'runoob', 70.2]  # 定义一个列表
# tinylist = [123, 'runoob']
#
# list.append(tinylist)
# print(list)
#
# tinylist.append("1111")
#
# print(tinylist)
#
# print(list)  # 打印整个列表
# print(list[0])  # 打印列表的第一个元素
# print(list[1:3])  # 打印列表第二到第四个元素（不包含第四个元素）
# print(list[2:])  # 打印列表从第三个元素开始到末尾
# print(tinylist * 2)  # 打印tinylist列表两次
# print(list + tinylist)  # 打印两个列表拼接在一起的结果

# print(1//5)
# print(1/5)
# print(2 ** 5)

# a, b, c, d = 20, 5.5, True, 4+3j
# print(type(a), type(b), type(c), type(d))
# print(d)


# a=b=c=1
# print("a=", a, "b=", b, "c=", c)

# name, age, salary = "小哈", 18, 1009.9
# print(name, age, salary)


# name = "小哈"
# age = 18
# salary = 1009.9
# print(name, age, salary)


# print("path:",  path)
# print("argv:",  argv)


# x, y = 'a', 'b'
# print(x)
# print(y)

# write = sys.stdout.write("  ww  你")
# print(write)

# s = input("\n\n输入任意字符继续")
# print(s)

# continuousStr = '''
# nihao
# 和地方士大夫撒旦
# 、\1\r\n\tdfsdfdsfsd
# dfdfffd
# dfdsfsd
# '''
# print(continuousStr)


# !/usr/bin/python3

# str='123456789'
#
# print(str)                 # 输出字符串
# print(str[0:-1])           # 输出第一个到倒数第二个的所有字符
# print(str[0])              # 输出字符串第一个字符
# print(str[2:5])            # 输出从第三个开始到第六个的字符（不包含）
# print(str[2:])             # 输出从第三个开始后的所有字符
# print(str[1:5:2])          # 输出从第二个开始到第五个且每隔一个的字符（步长为2）
# print(str * 2)             # 输出字符串两次
# print(str + '你好')         # 连接字符串
#
# print('------------------------------')
#
# print('hello\nrunoob')      # 使用反斜杠(\)+n转义特殊字符
# print(r'hello\nrunoob')     # 在字符串前面添加一个 r，表示原始字符串，不会发生转义


# cc = "*运算符重复字符串" * 20
# print(cc)
#
# dd = "基金大幅" + "20"
# print(dd)
#
# aa = "this " "is " " xkla "
# print(aa)
#
#
# bb = r"可以让反斜杠不发生转义\n\t\r\b\f\a\v\n\t\r\b\f\a\v\n\t\r\b\f\a\v\n\t\r\b\f\a\v\n\t\r\b\f\a\v"
# print(bb)


# count = 1 + \
#         2 + \
#         3
# print(count)
#
# arr = [1, 2,3]
# print(arr)
#
# arr2 = {"111", 222, '113'}
# print(arr2)

# if True:
#     print(1111)
# else:
#     print("2222")
#     print(333)

"""
# 输出保留的关键字
kwlist = keyword.kwlist
print(kwlist)
"""

'''
dfdfdfdfd
'''

# image = cv2.imread("E:\\camera\\image\\1.jpg", 0)
# print(image)
#
# imshow = cv2.imshow("halk_image", image)
#
# key = cv2.waitKey(2000)
# print(key)
#
# cv2.destroyAllWindows()
#
# shape = image.shape
# print(image.size)
# print(image.imag)
# print(image.dtype)
#
# cv2.imwrite("E:\\update.jpg", image)
